<template>
  <div class="app-container student_dashboard">

    <el-row class="app-item-contain">
      <h3 class="index-title-h3">固定试卷</h3>
      <div class="index-cont-items">
        <div class="items" :span="4" v-for="(item, index) in fixedPaper" :key="index">
          <el-card :body-style="{ padding: '0px' }" v-loading="loading">
            <img src="@/assets/exam-paper/show1.png" class="image">
            <div class="i_btn i_btn_col">
              <div class="i_tit">{{item.name}}</div>
              <div class="bottom clearfix">
                <router-link target="_blank" :to="{path:'/do',query:{id:item.id}}">
                  <el-button type="primary" size="mini" plain >开始做题</el-button>
                </router-link>
              </div>
            </div>
          </el-card>
        </div>
      </div>
    </el-row>

  </div>
</template>

<script>
import { mapState, mapGetters } from 'vuex'
import { paperIndex, paperTask } from '@/api/dashboard'
export default {
  data () {
    return {
      fixedPaper: [],
      timeLimitPaper: [],
      pushPaper: [],
      loading: false,
      taskLoading: false,
      taskList: []
    }
  },
  created () {
    let _this = this
    this.loading = true
    let param = {examType:10}
    paperIndex(param).then(re => {
      _this.fixedPaper = re.data.fixedPaper
      _this.timeLimitPaper = re.data.timeLimitPaper
      _this.pushPaper = re.data.pushPaper
      _this.loading = false
    })

   /* this.taskLoading = true
    paperTask().then(re => {
      _this.taskList = re.response
      _this.taskLoading = false
    })*/
  },
  methods: {
    statusTagFormatter (status) {
      return this.enumFormat(this.statusTag, status)
    },
    statusTextFormatter (status) {
      return this.enumFormat(this.statusEnum, status)
    }
  },
  computed: {
    ...mapGetters('enumItem', [
      'enumFormat'
    ]),
    ...mapState('enumItem', {
      statusEnum: state => state.exam.examPaperAnswer.statusEnum,
      statusTag: state => state.exam.examPaperAnswer.statusTag
    })
  }
}
</script>

